package io.adrainty.bolee.insurance.web;

import io.adrainty.bolee.framework.commons.basic.ResultDTO;
import io.adrainty.bolee.framework.commons.utils.ResultDTOUtil;
import io.adrainty.bolee.insurance.models.entity.InsuranceConditionEntity;
import io.adrainty.bolee.insurance.service.IInsuranceConditionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>InsuranceConditionController</p>
 *
 * @author AdRainty
 * @version V1.0.0
 * @description 保险筛选项
 * @since 2025/8/15 16:20:20
 */

@Tag(name = "保险筛选项")
@RestController
@RequestMapping("insurance-condition")
public class InsuranceConditionController {

    @Resource
    private IInsuranceConditionService insuranceConditionService;

    @PutMapping
    @Operation(summary = "保存保险筛选项")
    public ResultDTO<Boolean> createInsuranceCondition(@RequestBody List<InsuranceConditionEntity> conditionEntities) {
        Boolean result = insuranceConditionService.createInsuranceCondition(conditionEntities);
        return ResultDTOUtil.success(result);
    }

    @PatchMapping
    @Operation(summary = "更新保险筛选项")
    public ResultDTO<Boolean> updateInsuranceCondition(@RequestBody List<InsuranceConditionEntity> conditionEntities) {
        Boolean result = insuranceConditionService.updateInsuranceCondition(conditionEntities);
        return ResultDTOUtil.success(result);
    }

}
